using System;
using System.Collections;
using UnityEngine;

public abstract class Transition
{
	public abstract string Name { get; }

	public abstract IEnumerator CoTransitionIn(float duration);

	public abstract IEnumerator CoTransitionOut(float duration);

	public IEnumerator TranslateIn(float duration, object param)
	{
		if (this.needLock)
		{
			Scene.Lock();
		}
		Scene.OnWillEnterScene(param);
		yield return TaskManager.StartCoroutine(this.CoTransitionIn(duration));
		Scene.OnDidEnterScene();
		if (this.needLock)
		{
			Scene.Unlock();
		}
		yield break;
	}

	public IEnumerator TranslateOut(float duration, GameObject nextScene)
	{
		if (this.needLock)
		{
			Scene.Lock();
		}
		Scene.OnWillLeaveScene();
		yield return TaskManager.StartCoroutine(this.CoTransitionOut(duration));
		Scene.OnDidLeaveScene(nextScene);
		if (this.needLock)
		{
			Scene.Unlock();
		}
		yield break;
	}

	protected bool needLock = true;
}
